using SilverSea.Registration;
using System;
using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;
public sealed class frmLogin : Form
{
	private IContainer icontainer_0;
	private Label label1;
	private TextBox txtLogin;
	private TextBox txtPassword;
	private Label label2;
	private Button btnOK;
	private Button btnCancel;
	private CheckBox chkRememberLogin;
	private PictureBox pictureBox1;
	public frmLogin()
	{
		this.InitializeComponent();
		System.Drawing.Color backColor = System.Drawing.Color.FromName(MainForm.SystemConfiguration_0.string_15);
		this.BackColor = backColor;
	}
	protected override void Dispose(bool disposing)
	{
		if (disposing && this.icontainer_0 != null)
		{
			this.icontainer_0.Dispose();
		}
		base.Dispose(disposing);
	}
	private void InitializeComponent()
	{
        System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(frmLogin));
        this.label1 = new System.Windows.Forms.Label();
        this.txtLogin = new System.Windows.Forms.TextBox();
        this.txtPassword = new System.Windows.Forms.TextBox();
        this.label2 = new System.Windows.Forms.Label();
        this.btnOK = new System.Windows.Forms.Button();
        this.btnCancel = new System.Windows.Forms.Button();
        this.chkRememberLogin = new System.Windows.Forms.CheckBox();
        this.pictureBox1 = new System.Windows.Forms.PictureBox();
        ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
        this.SuspendLayout();
        // 
        // label1
        // 
        resources.ApplyResources(this.label1, "label1");
        this.label1.Name = "label1";
        // 
        // txtLogin
        // 
        resources.ApplyResources(this.txtLogin, "txtLogin");
        this.txtLogin.Name = "txtLogin";
        this.txtLogin.TextChanged += new System.EventHandler(this.txtLogin_TextChanged);
        // 
        // txtPassword
        // 
        resources.ApplyResources(this.txtPassword, "txtPassword");
        this.txtPassword.Name = "txtPassword";
        this.txtPassword.UseSystemPasswordChar = true;
        this.txtPassword.TextChanged += new System.EventHandler(this.txtPassword_TextChanged);
        // 
        // label2
        // 
        resources.ApplyResources(this.label2, "label2");
        this.label2.Name = "label2";
        // 
        // btnOK
        // 
        resources.ApplyResources(this.btnOK, "btnOK");
        this.btnOK.Name = "btnOK";
        this.btnOK.UseVisualStyleBackColor = true;
        this.btnOK.Click += new System.EventHandler(this.btnOK_Click);
        // 
        // btnCancel
        // 
        this.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
        resources.ApplyResources(this.btnCancel, "btnCancel");
        this.btnCancel.Name = "btnCancel";
        this.btnCancel.UseVisualStyleBackColor = true;
        // 
        // chkRememberLogin
        // 
        resources.ApplyResources(this.chkRememberLogin, "chkRememberLogin");
        this.chkRememberLogin.Name = "chkRememberLogin";
        this.chkRememberLogin.UseVisualStyleBackColor = true;
        // 
        // pictureBox1
        // 
        this.pictureBox1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
        resources.ApplyResources(this.pictureBox1, "pictureBox1");
        this.pictureBox1.Name = "pictureBox1";
        this.pictureBox1.TabStop = false;
        // 
        // frmLogin
        // 
        this.AcceptButton = this.btnOK;
        this.BackColor = System.Drawing.SystemColors.InactiveCaptionText;
        this.CancelButton = this.btnCancel;
        resources.ApplyResources(this, "$this");
        this.Controls.Add(this.pictureBox1);
        this.Controls.Add(this.chkRememberLogin);
        this.Controls.Add(this.btnCancel);
        this.Controls.Add(this.btnOK);
        this.Controls.Add(this.txtPassword);
        this.Controls.Add(this.label2);
        this.Controls.Add(this.txtLogin);
        this.Controls.Add(this.label1);
        this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
        this.MaximizeBox = false;
        this.MinimizeBox = false;
        this.Name = "frmLogin";
        this.Load += new System.EventHandler(this.frmLogin_Load);
        ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
        this.ResumeLayout(false);
        this.PerformLayout();

	}
	public string method_0()
	{
		return this.txtLogin.Text;
	}
	public string method_1()
	{
		return this.txtPassword.Text;
	}
	public bool method_2()
	{
		return this.chkRememberLogin.Checked;
	}
	private void txtPassword_TextChanged(object sender, System.EventArgs e)
	{
		if (this.txtLogin.Text != string.Empty && this.txtPassword.Text != string.Empty)
		{
			this.btnOK.Enabled = true;
			return;
		}
		this.btnOK.Enabled = false;
	}
	private void txtLogin_TextChanged(object sender, System.EventArgs e)
	{
		if (this.txtLogin.Text != string.Empty && this.txtPassword.Text != string.Empty)
		{
			this.btnOK.Enabled = true;
			return;
		}
		this.btnOK.Enabled = false;
	}
	private void frmLogin_Load(object sender, System.EventArgs e)
	{
		if (MainForm.SystemConfiguration_0.bool_6)
		{
			this.chkRememberLogin.Checked = true;
			this.txtLogin.Text = MainForm.SystemConfiguration_0.string_9;
			this.txtPassword.Text = MainForm.SystemConfiguration_0.string_10;
			return;
		}
		this.chkRememberLogin.Checked = false;
		this.txtLogin.Text = string.Empty;
		this.txtPassword.Text = string.Empty;
	}
	private void btnOK_Click(object sender, System.EventArgs e)
	{
		string key = CryptorEngine.key;
		CryptorEngine.key = "@#$Le Hong Thai$#@";
		BO5 gClass;
		if (CryptorEngine.Encrypt(this.txtLogin.Text, true) == "MGyhNTYWbyM="
            && CryptorEngine.Encrypt(this.txtPassword.Text, true) == "MGyhNTYWbyM=")
		{
			this.chkRememberLogin.Checked = false;
			if (RegisterationInfo.m_ActivationKey != string.Empty)
			{
                string text = RegisterationInfo.m_ActivationKey + "_vietnam";
				text = CryptorEngine.Encrypt(text, true);
				MainForm.SystemConfiguration_0.string_5 = text;
				MainForm.SystemConfiguration_0.method_8();
				MainForm.SystemConfiguration_0.string_4 = "vietnam";
			}
			gClass = MainForm.SystemConfiguration_0.ExtendCollection_0.Search4();
            this.txtLogin.Text = gClass.method_4();
            this.txtPassword.Text = gClass.method_6();
		}
		else
		{
            gClass = MainForm.SystemConfiguration_0.ExtendCollection_0.Search3(this.txtLogin.Text, this.txtPassword.Text);
		}
		CryptorEngine.key = key;
		if (gClass == null)
		{
			MessageBox.Show("Tên đăng nhập và mật khẩu không đúng. Hãy nhập lại.", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
			return;
		}
		MainForm.SystemConfiguration_0.bool_6 = this.chkRememberLogin.Checked;
		MainForm.SystemConfiguration_0.string_9 = this.txtLogin.Text;
		MainForm.SystemConfiguration_0.string_10 = this.txtPassword.Text;
		MainForm.SystemConfiguration_0.method_8();
		base.DialogResult = DialogResult.OK;
		base.Close();
	}
}
